//绘制一个条形图
function graphicList(yHeight1, yHeight2) {

  ctx.fillStyle = 'rgba(101, 60, 101, 1)';// rgba(200,200,200,1);//设置填充颜色
  ctx.fillRect(x, y, xWidth, -yHeight1);

  ctx.fillStyle = 'rgba(101, 160, 101, 1)';// rgba(200,200,200,1);//设置填充颜色
  ctx.fillRect(x + 30, y, xWidth, -yHeight2);
  x += 100;
}
//绘制图标坐标轴
function coordinateDrawing() {
  ctx.fillStyle = 'rgba(0, 0, 0, 1)';
  ctx.font = "20px 宋体";
  ctx.fillText('收入/费用报告', 10, 30);//填充
  ctx.beginPath();
  ctx.moveTo(20, 50);
  ctx.lineTo(20, 280);
  ctx.lineTo(560, 280);
  ctx.stroke();
}

// //获取当前所有单个表的所有数据]
//categor为数据库表的名称
function getNum(category, callback, sql) {
  $.ajax({
    url: '/wf_systemHomepage/get',
    mothed: 'GET',
    data: {
      category: category,
      sql: sql
    }
  })
    .done(function (res) {
      console.log('请求成功：');
      let num = res.data[0].total||res.data.length;
      let data = res.data
      console.log('查询到' + category + '的数量', num);
      callback(num, data);
    })
    .fail(function (err) {
      console.log('请求失败：', err);
    });
}

//老师名单列表
function teacherListRendering(num, data) {
  if (data.length == 0) {
    let li = `<li>
            数据库没有查询到信息
          </li>`;
    $('.wf-teacher-list').append(li)
  }
  console.log(data)
  for (var i = 0; i < data.length; i++) {
    teacherRander(data[i]);
  }

}
//单个老师渲染

function teacherRander(data) {
  let li = `<li>
            <div class="wf-teacher-img " style="background:url(${'../images/xzh_images/01.jpeg'}) no-repeat center /cover">
            </div>
            <div>
              <div class="wf-teacher-name">${data.teacher_name}</div>
              <div class="wf-teacher-num">工龄：${data.teacher_standing} &nbsp;学生：${'1000'}个</div>
            </div>
            <div class="wf-teacher-introduce"><a href="javascript:;" id='${data.teacher_id}'>查看介绍</a></div>
          </li>`;
  $('.wf-teacher-list').append(li)
}


//学生名单列表
function studentListRendering(num, data) {

  console.log(data)
  if (data.length == 0) {
    let tr = `<tr>
            <td>数据库没有查询到信息</td>
            
          </tr>`;
    $('.wf-table-list').append(tr)
  }
  for (var i = 0; i < data.length; i++) {
    studentRander(data[i]);
  }

};
//单个学生渲染
function studentRander(data) {
  let tr = `<tr>
            <td>${data.name}</td>
            <td>${data.class_name}</td>
            <td>马冬梅</td>
            <td>${data.years}</td>
            <td class="wf-student-file" id="${data.id}">查看档案</td>
          </tr>`;
  $('.wf-table-list').append(tr)
}